using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace FastFoodToNight.Models.Mapping
{
    public class UserProfileMap : EntityTypeConfiguration<NguoiDung>
    {
        public UserProfileMap()
        {
            // Primary Key
            this.HasKey(t => t.UserId);

            // Properties
            this.Property(t => t.UserName)
                .IsRequired()
                .HasMaxLength(56);

            this.Property(t => t.hoten)
                .HasMaxLength(50);

            this.Property(t => t.diachi)
                .HasMaxLength(200);

            this.Property(t => t.email)
                .HasMaxLength(50);

            this.Property(t => t.sodt)
                .HasMaxLength(20);

            // Table & Column Mappings
            this.ToTable("UserProfile");
            this.Property(t => t.UserId).HasColumnName("UserId");
            this.Property(t => t.UserName).HasColumnName("UserName");
            this.Property(t => t.hoten).HasColumnName("hoten");
            this.Property(t => t.ngaysinh).HasColumnName("ngaysinh");
            this.Property(t => t.gioitinh).HasColumnName("gioitinh");
            this.Property(t => t.diachi).HasColumnName("diachi");
            this.Property(t => t.email).HasColumnName("email");
            this.Property(t => t.sodt).HasColumnName("sodt");
        }
    }
}
